import Vue from 'vue'
import VueRouter from 'vue-router'
// 引入登录页面
import Login from '../views/Login.vue'
// 引入后台主页
import Index from '../views/Index.vue'
//引入采购与销售
import AddOrder from '../views/order/AddOrderView.vue'
import OrderLista from '../views/order/OrderListView.vue'
import ProcureApply from '../views/procure/ProcureApplyView.vue'
import Procurement from '../views/procure/ProcurementView.vue'
import ProcurePreview from '../views/procure/ProcurePreviewView.vue'
//引入库存
import OutBound from '../views/stock/OutBoundView.vue'
import AddOutBound from '../views/stock/AddOutBoundOrderView.vue'
import WareHousing from '../views/stock/WareHousingView.vue'
import AddWareHousing from '../views/stock/AddWareHousingView.vue'
//资金
//1.订单管理
import GoodsRecepit from '../views/fund/order/GoodsRecepit.vue'
import GoodsRemind from '../views/fund/order/GoodsRemind.vue'
import OrderList from '../views/fund/order/OrderList.vue'
import OrderSetup from '../views/fund/order/OrderSetup.vue'
//2.退款退货
import GoodsReturn from '../views/fund/refund_return/GoodsReturn.vue'
import RefundRequest from '../views/fund/refund_return/RefundRequest.vue'
import ReturnReason from '../views/fund/refund_return/ReturnReason.vue'
//3.快递
import CustomPrinting from '../views/fund/fastmail/CustomPrinting.vue'
import ExpressDeliveryNote from '../views/fund/fastmail/ExpressDeliveryNote.vue'
import ShippingInformation from '../views/fund/fastmail/ShippingInformation.vue'

//行为
//1.路线管理
import AddRoute from '../views/action/route/AddRoute.vue'
import EditRoute from '../views/action/route/EditRoute.vue'
import RouteManage from '../views/action/route/RouteManage.vue'
import UploadInfoManage from '../views/action/route/UploadInfoManage.vue'
import VisitResult from '../views/action/route/VisitResult.vue'
import VisitStatistics from '../views/action/route/VisitStatistics.vue'

//2.销售动态
import GoodsSale from '../views/action/sales/GoodsSale.vue'
import PersonnelSale from '../views/action/sales/PersonnelSale.vue'
import StoreSale from '../views/action/sales/StoreSale.vue'


//系统
//1.基本资料
import Company from '../views/system/Companyinformation.vue'
import Position from '../views/system/Positionmanagement.vue'
import Bmgl from '../views/system/bmgl.vue'
import Staff from '../views/system/Staffmanagement.vue'
import Warehouse from '../views/system/Warehousemanagement.vue'
import Unit from '../views/system/Unitmanagement.vue'
import Log from '../views/system/Operationlog.vue'

//2.客户管理
import Customerinformation from '../views/system/Customerinformation.vue'
import Customertype from '../views/system/Customertype.vue'
import Customerarea from '../views/system/Customerarea.vue'
import Supplier from '../views/system/Supplier.vue'

//3.商品管理
import Branding from '../views/system/Branding.vue'
import Productinformation from '../views/system/Productinformation.vue'
//4.价格管理
import Pricesystem from '../views/system/Pricesystem.vue'
Vue.use(VueRouter)

// 路由规则配置
const routes = [
  { path: '/', redirect: '/login' },
  { path: '/login', component: Login },
  {
    path: '/index', component: Index, redirect: '/procure/Procurement',
    children: [
      { path: '/procure/Procurement', component: Procurement },
      { path: '/procure/ProcureApply', component: ProcureApply },
      { path: '/procure/ProcurePreview', component: ProcurePreview },
      { path: '/order/OrderLista', component: OrderLista },
      { path: '/order/AddOrder', component: AddOrder },
      { path: '/stock/OutBound', component: OutBound },
      { path: '/stock/AddOutBound', component: AddOutBound },
      { path: '/stock/WareHousing', component: WareHousing },
      { path: '/stock/AddWareHousing', component: AddWareHousing },
      {
        path: '/procure/Procurement',
        component: Procurement,

      },
      //路线管理
      {
        path: '/routemanage', component: RouteManage,
        meta: {
          meun: 'routemanage'
        }
      },
      //添加路线
      {
        path: '/addroute',
        component: AddRoute,
        meta: {
          meun: 'addroute'
        }
      },
      //路线信息（编辑）
      {
        path: '/editroute/:id',
        component: EditRoute,
        meta: {
          meun: 'editroute'
        }
      },
      //拜访管理
      {
        path: '/visitresult',
        component: VisitResult,
        meta: {
          meun: 'visitresult'
        }
      },
      //拜访统计
      {
        path: '/visitstatistics',
        component: VisitStatistics
      },
      //信息上传管理
      {
        path: '/uploadinfo',
        component: UploadInfoManage
      },
      //• 人员销售动态
      {
        path: '/personnelsale',
        component: PersonnelSale
      },
      // • 商品销售动态
      {
        path: '/goodssale',
        component: GoodsSale
      },
      // • 门店销售动态
      {
        path: '/storesale',
        component: StoreSale
      },
      //资金
      //1.订单管理
      //• 订单列表
      {
        path: '/orderlist',
        component: OrderList
      },
      //• 确认收货
      {
        path: '/goodsrecepit',
        component: GoodsRecepit
      },
      //• 到货提醒
      {
        path: '/goodsremind',
        component: GoodsRemind
      },
      //• 订单设置
      {
        path: '/ordersetup',
        component: OrderSetup
      },
      //2.退款退货
      //• 退货申请处理
      {
        path: '/goodsreturn',
        component: GoodsReturn
      },
      //• 退款申请处理
      {
        path: '/refundrequest',
        component: RefundRequest
      },
      //• 退货原因设置
      {
        path: '/returnreason',
        component: ReturnReason
      },
      //3.快递单
      //• 快递单模板
      {
        path: '/note',
        component: ExpressDeliveryNote
      },
      //• 自定义打印项
      {
        path: '/printing',
        component: CustomPrinting
      },
      //• 发货点信息管理   
      {
        path: '/shippingInfo',
        component: ShippingInformation
      },
      //系统
      //1.基本资料
      //1-1.公司信息
      {
        path: '/company',
        component: Company
      },
      //1-2.部门管理
      {
        path: '/bmgl',
        component: Bmgl
      },
      //1-3.职位管理
      {
        path: '/position',
        component: Position
      },
      {
        path: '/staff',
        component: Staff
      },
      {
        path: '/warehouse',
        component: Warehouse
      },
      {
        path: '/unit',
        component: Unit
      },
      {
        path: '/log',
        component: Log
      },
      //2.客服管理
      //2-1.客户信息
      {
        path: '/customerinformation',
        component: Customerinformation
      },
      //2-2.客户类型
      {
        path: '/customertype',
        component: Customertype
      },
      //2-3.客户区域
      {
        path: '/customerarea',
        component: Customerarea
      },
      //2-4.供货厂商
      {
        path: '/supplier',
        component: Supplier
      },
      //3.商品管理
      //3-1.品牌管理
      {
        path: '/branding',
        component: Branding
      },
      //3-2.商品信息维护
      {
        path: '/productinformation',
        component: Productinformation
      },
      //4.价格管理
      //4-1.价格体系设置
      {
        path: '/pricesystem',
        component: Pricesystem
      }
    ]
  },

]

const router = new VueRouter({
  routes
})

//路由导航守卫
// router.beforeEach((to, from, next) => {
//     //to表示将要访问的路径
//     //from表示从哪个路径跳转而来
//     //next表示一个函数，放行：next() 强制跳转next("/login")
//     if(to.path == '/login'){
//        return next();
//     }else{
//        const respLoginVO =  window.sessionStorage.getItem("respLoginVO");
//        if(!respLoginVO){
//           return next("/login");
//        }
//     }
//     next()
// })

const router = new VueRouter({
  routes
})
export default router
